//
//  SYChooseObjViewController.m
//  ChatDemo-UI2.0
//
//  Created by syun on 16/7/15.
//  Copyright © 2016年 syun. All rights reserved.
//

#import "SYChooseObjViewController.h"
#import "SYLClassViewController.h"
#import "SYChooseClassesController.h"
@interface SYChooseObjViewController ()

@end

@implementation SYChooseObjViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"选择发送对象";
    
    self.view.backgroundColor=RGBACOLOR(244, 244, 244, 1);
    
    UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(12, 18, SCREENWIDTH-24, 14)];
    label.text=@"请选择一类发送对象";
    label.font=[UIFont systemFontOfSize:14];
    label.textColor=RGBACOLOR(151, 151, 151, 1);
    [self.view addSubview:label];
    
    UIView *line=[[UIView alloc]initWithFrame:CGRectMake(0, label.frame.origin.y+label.frame.size.height+8, SCREENWIDTH, 0.5)];
    line.backgroundColor=RGBACOLOR(199, 199, 204, 1);
    [self.view addSubview:line];
    
    _table = [[UITableView alloc] initWithFrame:CGRectMake(0,line.frame.origin.y+0.5, VIEW_WIDTH, 84) style:UITableViewStylePlain];
    _table.delegate = self;
    _table.dataSource = self;
    _table.backgroundColor=RGBACOLOR(244, 244, 244, 1);
    _table.separatorStyle=UITableViewCellSeparatorStyleNone;
    _table.scrollEnabled=NO;
    [self.view addSubview:_table];
    // Do any additional setup after loading the view.
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return  2;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 42;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *headCellId = @"cellid";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:headCellId];
    
    if (cell == nil) {
        
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:headCellId];
    }
    
    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    UIView *line=[[UIView alloc]init];
    line.backgroundColor=RGBACOLOR(199, 199, 204, 1);
    [cell.contentView addSubview:line];
    
    UILabel *nameLabel=[[UILabel alloc]initWithFrame:CGRectMake(12, 14, 200, 14)];
    nameLabel.font=[UIFont systemFontOfSize:14];
    nameLabel.textColor=RGBACOLOR(59, 59, 59, 1);
    [cell.contentView addSubview:nameLabel];
    
    if (indexPath.row==0) {
        nameLabel.text=@"发送至一个或多个班级";
        line.frame = CGRectMake(12, 41.5, SCREENWIDTH-12, 0.5);
    }else
    {
        nameLabel.text=@"发送至一名或多名宝宝";
        line.frame = CGRectMake(0, 41.5, SCREENWIDTH, 0.5);
    }
       cell.selectionStyle=UITableViewCellSelectionStyleNone;
    
    return cell;
}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row==1) {
        SYLClassViewController *lClassVC=[[SYLClassViewController alloc]init];
        lClassVC.claArray=_classesArray;
        [self.navigationController pushViewController:lClassVC animated:YES];
    }else
    {
        SYChooseClassesController *chooseClassVC=[[SYChooseClassesController alloc]init];
        chooseClassVC.claArray=_classesArray;
        [self.navigationController pushViewController:chooseClassVC animated:YES];
    }

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
